﻿using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using TissotWeb.GoogleMaps.Models;

namespace TissotWeb.GoogleMaps.Drivers {
    public class GoogleMapSettingsPartDriver : ContentPartDriver<GoogleMapSettingsPart>
    {
        protected override DriverResult Editor(GoogleMapSettingsPart part, dynamic shapeHelper)
        {
            return ContentShape("Parts_GoogleMap_Settings_Edit",
                () => shapeHelper.EditorTemplate(
                    TemplateName: "Parts/GoogleMap.Settings",
                    Model: part,
                    Prefix: Prefix));
        }

        protected override DriverResult Editor(GoogleMapSettingsPart part, IUpdateModel updater, dynamic shapeHelper)
        {
            updater.TryUpdateModel(part, Prefix, null, null);
            return Editor(part, shapeHelper);
        }
    }
}